package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.Result;
import com.atguigu.eduservice.entity.vo.subject.OneSubject;
import com.atguigu.eduservice.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;
//import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2024-06-21
 */
@RestController
@RequestMapping("/eduservice/subject/")
@CrossOrigin
public class EduSubjectController {
    @Autowired
    private EduSubjectService subjectService;
    @PostMapping("addSubject")
    public Result addSubject(MultipartFile file) {
        //上传过来的文件
        subjectService.saveSubject(file,subjectService);
        return Result.ok();
    }
    //课程分类列表（树型）
    @GetMapping("getAllSubject")
    public Result getAllSubject(){
        List<OneSubject> list = subjectService.getAllOneTwoSubject();
        return Result.ok().data("list",list);
    }

}

